package com.hospital.common.dto.search.module;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class PostInsertDto {
    /**
     * 帖子元数据id
     */
    @NotNull(message = "帖子元数据id不能为空")
    private Long metaId;

    /**
     * 板块id
     */
    @NotNull(message = "板块id不能为空")
    private Long sectionId;

    /**
     * 作者id
     */
    @NotNull(message = "作者id不能为空")
    private Long authorId;

    /**
     * 标题
     */
    private String title;

    /**
     * 摘要
     */
    private String abstracts;

    /**
     * 是否置顶
     */
    private Integer isTop;

    /**
     * 是否加精
     */
    private Integer isPinned;

    /**
     * 点赞数
     */
    private Integer likeCount;

    /**
     * 回复数
     */
    private Integer replyCount;

    /**
     * 创建时间
     */
    @NotNull(message = "创建时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime createTime;

    /**
     * 最后回复时间
     */
    @NotNull(message = "最后回复时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime updateTime;

    /**
     * 收藏数
     */
    private Integer favoriteCount;
    /**
     * 帖子附件url(镇楼图,可以为空)
     */
    private String firstAttachmentUrl;

    /**
     * 热度
     */
    private Long heatScore;

    /**
     * 作者角色
     */
    private Integer authorRole;
}
